<?php

namespace App\Admin\Controllers;

use Encore\Admin\Form;
use Encore\Admin\Grid;
use App\Models\AppleTreesRecord;
use Encore\Admin\Controllers\AdminController;

class HipsterAppleTreesRecordsController extends AdminController
{
    protected $title = '变异苹果树记录';

    protected function grid()
    {
        $grid = new Grid(new AppleTreesRecord());
        $grid->model()->orderBy('id');

        $grid->column('id', 'ID');
        $grid->column('user_id', '会员')->display(function () {
		    return $this->user ? $this->user->nameText(true) : '';
	    });

	     $grid->column('apple_tree_id', '标题')->display(function () {
		    return $this->appleTree() ? $this->appleTree->title : '';
	    });
        
        $grid->column('money', '实际支付价格');

         $grid->column('paid_at', '支付时间')->display(function ($value) {
        	return $value ? $this->paid_at : '';
        });

         $grid->column('expired_at', '到期时间')->display(function ($value) {
        	return $value ? $this->expired_at : '';
        });
        

         $grid->disableRowSelector();
	    $grid->disableColumnSelector();
	    $grid->disableExport();
	    $grid->disableCreateButton();
	    $grid->disableActions();

        return $grid;
    }

	
}
